<?php

/*

   Aiesec's OH Management System - to control the Office Hour of Aiesec's Members.
   Copyright (C) 2009 Vinicius Stein Dani

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License
   as published by the Free Software Foundation; either version 2
   of the License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

*/

/*
  
   Author: Vinicius Stein Dani
   Contact: viniciussdani@gmail.com
   Today is: March 15, 2009
   Location at this present moment: Santa Maria - RS - Brasil
  
*/

?>

<?php

if( isset( $_POST['submit'] ) )
{
 
	include_once '_v_login.php';
			
	$login = $_POST['login_usuario'];
	$senha = $_POST['senha_usuario'];
	$to_no_cl = $_POST['to_no_cl'];
	
	$verifica_usuario = mysql_query("SELECT * FROM usuarios WHERE login = '$login' AND senha = '$senha'");
	$conta_usuario = mysql_num_rows( $verifica_usuario );
		
	if($conta_usuario == 1) 
  {
		$_SESSION['login_usuario'] = $login;
		$_SESSION['senha_usuario'] = $senha;
		
		if($to_no_cl == "S")
		  $_SESSION['to_no_cl'] = $to_no_cl;
		else
		  $_SESSION['to_no_cl'] = "";
				
		echo "		
		<script>
		window.location = 'index.php?menu=perfil';
		</script>
		";
	} else {
		
		echo "
		<script>
		window.location = 'index.php?opcao=login';
		</script>
		";
		
	}

}

?>

    <table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td valign="top" align="left">


          <form action="<?php echo $_SERVER['PHPSELF']; ?>" method="post">
          <table style="padding-left: 2px;">
            <tr> 
              <td>
                <div class="texto_noticia_descricao">Login</div>
              </td>
              <td>
                <input type="text" name="login_usuario" style="width: 150px" maxlenght="35" />
              </td>
 
              
              <td align="right">
                <div class="texto_noticia_descricao">Senha</div>
              </td>
                
              <td>
                <input type="password" name="senha_usuario" style="width: 150px" maxlenght="35" />
              </td>

              <td>  
                <input type="submit" name="submit" value="OK" 
                style="background-color: #000000; font-family: verdana, arial, tahoma; font-size: 10px; color: #FFFFFF; height: 20px; border: 0px;" />
              </td>
              
              <td>
                <div class="texto_noticia_descricao">( <a href="index.php?menu=esqueci_senha">Esqueci minha senha</a> | <a href="index.php?menu=registro"><b>Registre-se</b></a> )</div>
              </td>
            </tr>
          </table>
          </form>
           
       </td>
     </tr>
   </table>